<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <meta name="format-detection" content="telephone=no" />
        <title>实力库存</title>
        <link rel="stylesheet" type="text/css" href="../css/aui.css" />
        <link rel="stylesheet" type="text/css" href="../css/common.css" />
        <style>
            body{
                background: #fff;
                font-size: 16px;
            }
/*            header{
                width: 100%;
                line-height: 45px;
                height:80px;    
                background: #fff;
                position: relative;
            }
            .aui-icon-left{
                padding-left:10px;
            }
            .win_title{
                width: auto;
                text-align: center;
                position: absolute;
                right: 80px;
                left: 80px;
            }*/
              
            .tategoryList{
                display: -webkit-box;
                width: 100%;
                height: 35px;
                line-height: 35px;
                color:#333;
            }
            .tategoryList li{
                -webkit-box-flex:1;
                font-size: 14px;
                text-align: center;
            }
            .zf li.active:before{
                width: 70%;
                left: 15%;
            }
            .myBorder:before{
                bottom:98%;
            }
            .aui-icon-search:before{
                margin-right: 5px;
            }
        </style>
    </head>
    <body>
        <header class="aui-bar aui-bar-nav aui-border-b">
            <div id="header_status">
                <div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
                <div class="aui-title">实力库存</div>
                <div class="aui-pull-right aui-iconfont aui-icon-search icon-left-coler" tapmode onclick="showSearch();" style="padding-left: 15px;"></div>
            </div>
            <div class="aui-searchbar-wrap" id="search" style="height:45px;background:none;display: none;">
                <div class="aui-searchbar aui-border-radius" tapmode onclick="doSearch()">
                    <i class="aui-iconfont aui-icon-search"></i>
                    <div class="aui-searchbar-text">输入首字母</div>
                    <div class="aui-searchbar-input">
                        <form action="javascript:search();">
                            <input type="search" placeholder="请输入搜索内容" id="search-input">
                        </form>
                    </div>
                    <i class="aui-iconfont aui-icon-roundclosefill" tapmode onclick="clearInput()"></i>
                </div>
                <div class="aui-searchbar-cancel aui-text-info" tapmode onclick="cancelSearch()">取消</div>
            </div>
            <ul class="tategoryList zf myBorder">
                <li class="active" data-type="0" tapmode onclick="changeCheck(this)">全部</li>
                <li tapmode data-type="1" onclick="changeCheck(this)">尾货</li>
                <li tapmode data-type="2" onclick="changeCheck(this)">断码</li>
                <li tapmode data-type="3" onclick="changeCheck(this)">小批量</li>
                <li tapmode data-type="4" onclick="changeCheck(this)">残次品</li>
            </ul>
        </header>
<!--         <header>
                <div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
                <div class="win_title">
                    实力库存
                </div>
                <ul class="tategoryList zf myBorder">
                    <li class="active" data-type="0" tapmode onclick="changeCheck(this)">全部</li>
                    <li tapmode data-type="1" onclick="changeCheck(this)">尾货</li>
                    <li tapmode data-type="2" onclick="changeCheck(this)">断码</li>
                    <li tapmode data-type="3" onclick="changeCheck(this)">小批量</li>
                    <li tapmode data-type="4" onclick="changeCheck(this)">残次品</li>
                </ul>
        </header> -->
    </body>
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/common.js"></script>
    <script type="text/javascript" src="../script/doT.min.js"></script>
    <script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="../script/iscroll.js"></script>
    <script type="text/javascript">
        apiready = function() {
            api.parseTapmode();
            var mobile = api.pageParam.mobile;
            var header = $api.dom('header');
            $api.fixIos7Bar(header);
            
            var header_h = $api.offset(header).h;
            var body_h = $api.offset($api.dom('body')).h - header_h;
            // var statusbarHeight=api.systemType=='ios'?20.0:0.0;
            api.openFrame({
                name : 'stock_frm',
                url : 'stock_frm.html',
                rect : {
                    x : 0,
                    y : header_h,
                    w : 'auto',
                    h : body_h
                },
                pageParam : {
                    mobile : mobile
                },
                bounces : false,
                vScrollBarEnabled : false,
                hScrollBarEnabled : false
            });
        }
        //为了在下面的热门类别可以通用，单独出来
        function changeCheck(obj){
            $(obj).parent().find("li").removeClass("active");
            $(obj).addClass("active");
            var type = $(obj).attr('data-type');
            api.sendEvent({
                name: 'stockType',
                extra: {
                    stockType: type
                }
            });
        }

        function showSearch(){
            $('#header_status').hide();
            $('#search').show();

            doSearch();
        }

         function doSearch(){
            $api.addCls($api.dom(".aui-searchbar-wrap"),"focus");
            $api.dom('.aui-searchbar-input input').focus();
        }
        function cancelSearch(){
            $api.removeCls($api.dom(".aui-searchbar-wrap.focus"),"focus");
            $api.val($api.byId("search-input"),'');
            $api.dom('.aui-searchbar-input input').blur();

            $('#header_status').show();
            $('#search').hide();
        }
        function clearInput(){
            $api.val($api.byId("search-input"),'');
        }
        function search(){
            var content = $api.val($api.byId("search-input"));
            if(content){
                api.openWin({
                    name: 'proList',
                    url: 'proList_win.html',
                    pageParam: {
                        searchValue: content
                    }
                });
            }else{
                api.alert({
                    title: '搜索提示',
                    msg: '您没有输入任何内容'
                });
            }
            window.setTimeout(function(){
                cancelSearch();
            },1500);
        }
    </script>
</html>
